#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    connect(this,&Widget::mysig,this,&Widget::myhandle);
}

Widget::~Widget()
{
    delete ui;
}

//信号可以传参
void Widget::on_pushButton_clicked()
{
    //emit mysig("标题1");
    emit mysig("标题1",1);
}

void Widget::on_pushButton_2_clicked()
{
    //emit mysig("标题2");
    emit mysig("标题2",2);
}

void Widget::myhandle(const QString & s)
{
    this->setWindowTitle(s);
}
